package com.clqteam.controller;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.clqteam.model.Employee;
import com.clqteam.service.DailyService;
import com.clqteam.service.SelectVIPLXGService;
import com.clqteam.serviceimpl.DailyServiceImpl;
import com.clqteam.serviceimpl.SelectVIPLXGServiceImpl;

import net.sf.json.JSONObject;
/**
 * 通过会员编号或开卡日期模糊查询会员信息
 * @author Administrator
 *LXG
 */
public class SelectVIPByKeyLXGController extends HttpServlet{
	SelectVIPLXGService svs=new SelectVIPLXGServiceImpl();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doPost(req, resp);
	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		req.setCharacterEncoding("utf8");
		resp.setCharacterEncoding("utf8");
		//引用日志
	    DailyService ds=new DailyServiceImpl();
		HttpSession session=req.getSession();
		Employee e=(Employee) session.getAttribute("employee");
		int eId=e.geteId();
		String eName=e.geteName();
		String function="查询会员信息";
		
		String key=req.getParameter("keyword");
		int key1=Integer.parseInt(key);
		String pa=req.getParameter("page");
		int page=Integer.parseInt(pa);
		String row=req.getParameter("rows");
		int rows=Integer.parseInt(row);
		JSONObject jo=svs.selectVip(key, key1, page, rows);
		PrintWriter pw=resp.getWriter();
		ds.functionDaily(function, eId, eName);
		pw.write(jo.toString());
		pw.flush();
		pw.close();
		
	}
	
}
